import requests,json
import pandas as pd
def geocode(key,address,city=None,batch=None):
    """获取高德API的地理编码
    注释：key是指高德API的秘钥，请先去注册
          address是指结构化地址，具体请查看：https://lbs.amap.com/api/webservice/guide/api/georegeo
    """
    url = "https://restapi.amap.com/v3/geocode/geo?parameters"
    params = {
        "key":key,
        "address":address,
        "city":city,
        "batch":batch
    }
    response = requests.get(url,params=params)
    results = response.json()['geocodes'][0]['location']
    # 返回值
    return results
def walking(key,origin,destination,sig=None,output="json",callback=None):
    url = "https://restapi.amap.com/v3/direction/walking?parameters"
    params ={
        "key":key,
        "origin":origin,
        "destination":destination,
        "sig":sig,
        "output":output,
        "callback":callback
    }
    r = requests.get(url,params)
    results = r.json()
    return results